<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>js/lib/jquery/zTree/css/demo.css"/>
<link rel="stylesheet" href="<%=basePath%>js/lib/jquery/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
<jsp:include page="/admin/common/css/style_sub.jsp"></jsp:include>
<script type="text/javascript" src="<%=basePath%>js/lib/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/lib/jquery/zTree/js/jquery.ztree.core-3.3.js"></script>
<script type="text/javascript">
var setting = {
	data: {
		simpleData: {
			enable: true
		}
	},callback:{onClick:showDicByType}
};
var dtypeJson = ${dicTypeListJson };
for(var i=0;i<dtypeJson.length;i++){
	dtypeJson[i].pId=0;
}
dtypeJson[dtypeJson.length]={ id:0, pId:-1, name:"字典类别", open:true};
//alert(dtypeJson);
var zNodes =dtypeJson;

$(document).ready(function(){
	$.fn.zTree.init($("#treeDemo"), setting, zNodes);
});

function showDicByType(event, treeId, treeNode) {
    $("#frame_dic").attr("src","<%=basePath%>basic/sys/dic_getDicByType.action?sysDictionary.typeid="+treeNode.id);
};

function editdic(id){
	if(id){
	 	$("#frame_dic").attr("src","<%=basePath%>basic/sys/dic_toDicEditPage.action?sysDictionary.id="+id);
	}else{
		$("#frame_dic").attr("src","<%=basePath%>basic/sys/dic_toDicEditPage.action");
	}
}

function reinitIframe(){

var iframe = document.getElementById("frame_dic");

try{

var bHeight = iframe.contentWindow.document.body.scrollHeight;

var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;

var height = Math.max(bHeight, dHeight);

iframe.height =  height;

}catch (ex){}

}

window.setInterval("reinitIframe()", 200);


</script>
<style type="text/css">

</style>
</head>
<body>
<div class="struLeft" style="width: 24%"><ul id="treeDemo" class="ztree"></ul></div>
<div class="struRight" style="width: 75%"><iframe id="frame_dic" scrolling="no" height="99%" width="99%" frameborder="0" src="<%=basePath%>admin/basic/system/basicdata/dict_frame.jsp"></iframe></div>
</body>
</html>
